package sysAuth

import initConfig.SysInitData

/**
 * @athor xxd
 * 操作角色：针对单只报表设置拥有的操作权限
 * 新增、删除、导出、导入、批量删除
 */
class SysOperations {
    //<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>

    String operateNo;
    String operateName;
    String type = SysInitData.ROW_BUTTON;//行级权限、表级权限
    String marks;
    String icon = "layui-icon-tips"; //图标
    String style = "layui-btn-sm";//脚本
    int orderNum = 0;
    String creator ;//操作人
    String updater;//最近一次更新人
    Date dateCreated;
    Date lastUpdated;

    static constraints = {
        operateNo(nullable: false,blank: false   )
        marks(nullable: true)
        icon(nullable: true)
        style(nullable: true)
        type(nullable: true)
        creator(nullable: false)
        updater(nullable: true)
    }
    static mapping = {
        version false
    }

    static init(){
        if(SysOperations.count ==0){
           [detail:"详细",del:"删除",edit:"编辑",addAuth:"分配权限",test:"测试",copy:"复制",updateReadAll:"全部已读",
            updateRead:"标记已读"].each {key,value ->
               new SysOperations(operateNo:key,operateName:value,creator: SysInitData.SYS_ADMIN ,type: SysInitData.ROW_BUTTON).save(flush: true)
           }

            [save:"保存",add:"新增",downLoad:"下载",upLoad:"导入",query:"查询",monitor:"定时刷新",addPublicNotice:"发布公告"].each {key,value ->
                new SysOperations(operateNo:key,operateName:value,creator: SysInitData.SYS_ADMIN ,type: SysInitData.FORM_BUTTON).save(flush: true)
            }

        }
    }
}
